{if $viewattendance == true}
<form name="form1" id="form1" {if $adding != true}action="{$pagename}&eventid={$eventinfo.id}"{else}action="{$pagename}&action=add"{/if} method="POST">
{if $adding != true}<h2>{$eventinfo.name} ({$eventinfo.date+$timeoffset|date_format:"%B %e %Y"})</h2>{else}
Name of event: <input type="text" name="eventname" id="eventname" class="inputbox" size="40" /><br />
Date of event: <input name="date" id="date" type="text" size="20" maxlength="20" class="inputbox" readonly="readonly" /><button id="opencal" name="opencal" class="button">Calender</button><br />
{/if}
{section name=groups loop=$numgroups}
<strong>{$attendance[groups].groupname}</strong><br />
{section name=users loop=$attendance[groups].numusers}
{if $readonly==false}<input type="checkbox" name="{$attendance[groups].userlist[users].uname|replace:' ':'_'}" id="{$attendance[groups].userlist[users].uname|replace:' ':'_'}" value="0" {if $attendance[groups].userlist[users].attend == 1}checked="checked"{/if} />{else}{if $attendance[groups].userlist[users].attend == 1}<img src="{$tempdir}admin/images/unpublish.png" border="0" alt="Attended" title="Attended" />{else}<img src="{$tempdir}admin/images/publish.png" border="0" alt="Not Attended" title="Not Attended" />{/if}{/if}&nbsp;{$attendance[groups].userlist[users].name} ({$attendance[groups].userlist[users].uname})<br />
{sectionelse}No users in group<br />
{/section}
{/section}
{if $readonly==false}<input type="submit" name="submit" id="submit" class="button" value="Submit" />{/if}<input type="button" name="cancel" id="cancel" class="button" value="Cancel" onclick="window.history.go(-1);"/>
</form>
{if $adding == true}
<script type="text/javascript">
  {literal}
  Calendar.setup(
    {
      inputField  : "date",         // ID of the input field
      ifFormat    : "%Y-%m-%d",    // the date format
      button      : "opencal"       // ID of the button
    }
  );
  {/literal}
</script>
{/if}
{else}
{if $numattend > 0}
{literal}
<script type="text/javascript">
<!--
function confirmDelete(articleId) {
if (confirm("This will remove the attendance register for the event. Continue?"))
  {/literal}
document.location = "{$pagename}&action=delete&id=" + articleId;
{literal}
}
-->
</script>
{/literal}
<h2>Authorization Settings</h2>
<div align="left"><input type="button" class="button" value="Add Event" onclick="window.location='{$pagename}&amp;action=add'" /></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
  <tr valign="top"> 
    <th width="10%" class="smallhead">Action</th>
    <th class="smallhead" width="30%">Name</th>
    <th class="smallhead" width="10%">Date</th>
    <th class="smallhead">Patrol</th>
  </tr>
 {section name=front loop=$numattend}
	  <tr valign="middle"> 
		<td width="10%"  class="text"><a href="{$pagename}&amp;eventid={$attendance[front].id}"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit attendance for {$auths[front].name}" title="Edit attendance for {$attendance[front].name}" /></a> - <a href="javascript:confirmDelete({$attendance[front].id})">
        <img src="{$tempdir}admin/images/delete.gif" border="0" alt="Remove attendance for {$attendance[front].name}" title="Remove attendance for {$attendance[front].name}" /></a></td>
		<td class="text"><div align="left">{$attendance[front].name}</div></td>
        <td class="text"><div align="left">{$attendance[front].date+$timeoffset|date_format:"%B %e %Y"}</div></td>
		<td class="text"><div align="left">{$attendance[front].patrol}</div></td>
      </tr>  
    {/section}
</table>
{else}
<div align="center">No attendance register entries</div>
{/if}
<div align="left"><input type="button" class="button" value="Add Event" onclick="window.location='{$pagename}&amp;action=add'" /></div>
{/if}